<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:cc="http://java.sun.com/jsf/composite">

	<h:body>
		<ui:composition>  
		
			<!-- Dialog permettant la création d'un nouveau fichier texte -->
		    <p:dialog header="#{msg['createNewFileDialogTitle']}" widgetVar="dlgNewTxtFile" draggable="false" resizable="false" modal="true">
			    
			    <h:form id="formNewFile">  
					<h:panelGrid columns="2" style="margin-bottom:10px">  
				        <h:outputLabel for="name" value="#{msg['fileName']}" />  
				        <p:inputText id="name" value="#{driveManagedBean.filename}" required="true">
				        	<f:validator validatorId="fileNameValidator" />
			         	</p:inputText>    
					</h:panelGrid> 
					     
					<p:separator />
					<p:commandButton styleClass="buttonDialog"
									 value="#{msg['create']}" 
									 action="#{driveManagedBean.createFile}" 
									 oncomplete="creationFileRequest(xhr, status, args)" 
									 update=":formTable"/>         
			    </h:form>
		    </p:dialog>
			    
			<!-- Dialog permettant la création d'un nouveau répertoire -->
			<p:dialog header="#{msg['createNewFolderDialogTitle']}" widgetVar="dlgNewDir" draggable="false" resizable="false" modal="true">
			
				<h:form id="formNewFolder">  
			
			    	<h:panelGrid columns="2" style="margin-bottom:10px">  
			         	<h:outputLabel for="name" value="#{msg['folderName']}" />  
			         	<p:inputText id="name" value="#{driveManagedBean.dirname}" required="true" >
			         		<f:validator validatorId="fileNameValidator" />
			         	</p:inputText>   
			     	</h:panelGrid>  
					<p:growl id="messages" showDetail="true" /> 
			   	
			   		<p:separator />
			    	<p:commandButton styleClass="buttonDialog" 
			    					 value="#{msg['create']}" 
			    				     action="#{driveManagedBean.createDirectory}" 			    				     
									 oncomplete="creationFolderRequest(xhr, status, args)" 
			    				     update=":formTable :formTree :formBreadCrumb :formDetails"/>     
			          
			 	</h:form>
			</p:dialog>  
			
			<script type="text/javascript">
				function creationFolderRequest(xhr, status, args) {
					if(!args.validationFailed) {						
						dlgNewDir.hide();
					}
				}
				
				function creationFileRequest(xhr, status, args) {
					if(!args.validationFailed) {						
						dlgNewTxtFile.hide();
					}
				}
			</script>
			
	    </ui:composition>
	</h:body>
</html>

